﻿<!--revision $Id$-->
<Window x:Class="WellLogControlSample.dlgChartScales"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="clr-namespace:WellLogControlSample"
	WindowStartupLocation="CenterOwner"
	FocusManager.FocusedElement="{Binding ElementName=txtDepthScale}"
	SizeToContent="WidthAndHeight" ResizeMode="NoResize"
	Title="Chart Scales"
	BorderBrush="Cornsilk" BorderThickness="15" 
	Background="AliceBlue">

	<Window.Resources>
		<Style TargetType="Label">
			<Setter Property="VerticalAlignment" Value="Center" />
			<Setter Property="Padding" Value="5" />
		</Style>
		<Style TargetType="Button">
			<Setter Property="VerticalAlignment" Value="Center" />
			<Setter Property="Margin" Value="5, 10, 5, 5" />
		</Style>
		<Style x:Key="dialogButton" TargetType="Button">
			<Setter Property="VerticalAlignment" Value="Center" />
			<Setter Property="Margin" Value="5, 10, 5, 5" />
			<Setter Property="Width" Value="72" />
		</Style>
		<Style TargetType="{x:Type TextBox}">
			<Setter Property="Validation.ErrorTemplate">
				<Setter.Value>
					<ControlTemplate>
						<DockPanel LastChildFill="True">
							<TextBlock DockPanel.Dock="Right" Foreground="Red"
								FontSize="16" FontWeight="Bold"
								ToolTip="{Binding ElementName=adornerPlaceholder, 
									Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"
								Text=" !"/>
							<Border BorderBrush="Red" BorderThickness="2">
								<AdornedElementPlaceholder Name="adornerPlaceholder"/>
							</Border>
						</DockPanel>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</Window.Resources>
	
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition/>
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto"/>
			<ColumnDefinition Width="Auto"/>
		</Grid.ColumnDefinitions>

		<!-- DepthScale row -->
		<Label Target="{Binding ElementName=txtDepthScale}">Depth Scale</Label>
		<TextBox Grid.Column="1" Name="txtDepthScale"
			 Text="{Binding Path=DepthScale, UpdateSourceTrigger=PropertyChanged,
				ValidatesOnExceptions=True, ValidatesOnDataErrors=True}"/>

		<!-- ChartWidth row -->
		<Label Grid.Row="1" Target="{Binding ElementName=txtChartWidth}">Chart Width</Label>
		<TextBox Grid.Row="1" Grid.Column="1" Name="txtChartWidth"
			 Text="{Binding Path=ChartWidth, UpdateSourceTrigger=PropertyChanged,
				ValidatesOnExceptions=True, ValidatesOnDataErrors=True}"/>

		<!-- Dialog buttons row -->
		<StackPanel Grid.Row="2" Grid.ColumnSpan="2" Orientation="Horizontal" 
					HorizontalAlignment="Right" VerticalAlignment="Bottom">
			<Button Name="btnOK" Click="btnOK_Click"  Style="{StaticResource dialogButton}" IsDefault="True" IsEnabled="False">OK</Button>
			<Button Style="{StaticResource dialogButton}" IsCancel="True">Cancel</Button>
		</StackPanel>
	</Grid>
</Window>
